﻿@using DIS.Infrastructure.Entities.Entity;
@{
    ViewBag.Title = "汇总明细";
    Layout = "~/Views/Shared/_Layout.cshtml";

    CityTaxi taxiFee = ViewBag.taxiFee;
    HotelFee hotelFee = ViewBag.hotelFee;
    LongHaul longFee = ViewBag.longFee;
    User user = ViewBag.user;
    Project project = ViewBag.project;

    decimal taxiMoney = taxiFee == null ? 0 : taxiFee.TaxiFee;
    int taxiInvoice = taxiFee == null ? 0 : taxiFee.InvoiceCount;

    decimal hotelMonty = hotelFee == null ? 0 : hotelFee.TotalFee;
    int hotelInvoice = hotelFee == null ? 0 : hotelFee.InvoiceCount;

    decimal longMonty = longFee == null ? 0 : longFee.TotalFee;
    int longInvoice = longFee == null ? 0 : longFee.InvoiceCount;
    decimal allowanceMoney = longFee == null ? 0 : longFee.AllowanceMoney;
    
    int totalInvoice = taxiInvoice + hotelInvoice + longInvoice;
    decimal totalMoney = taxiMoney + hotelMonty + longMonty;
    decimal lastMoney = totalMoney + allowanceMoney;

    int days = longFee == null ? 0 : longFee.TotalDays;
    string year = taxiFee == null ? DateTime.Now.Year.ToString() : taxiFee.Year;
    string month = taxiFee == null ? DateTime.Now.Month.ToString().PadLeft(2, '0') : taxiFee.Month;
    
}
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#D6D6D6">
    <tr>
        <td height="19" background="/content/img/tbg.gif" bgcolor="#E7E7E7">
            <table width="96%" border="0" cellspacing="1" cellpadding="1">
                <tr>
                    <td style="padding-left: 10px;">
                        <b><strong>汇总明细</strong></b>
                    </td>
                    <td align="right">
                        <b><strong><a href="/Reimbursement/GetAllSummary">汇总列表</a></strong></b>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center" valign="top" bgcolor="#FFFFFF">
            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
                <tr>
                    <td colspan="4" style="font-size: 20px; font-weight: bold">
                        @(project.ProjectName)项目组差旅费汇总表(@(year)年@(month)月)
                    </td>
                </tr>
                <tr>
                    <td>
                        报销人：@user.RealName
                    </td>
                    <td>
                        部门：@user.DepartMentName
                    </td>
                    <td>
                        总人天数：@days
                    </td>
                    <td>
                        差旅费总计：@lastMoney
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center" valign="top" bgcolor="#FFFFFF">
            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D6D6D6">
                <tr>
                    <td>
                        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
                            <thead>
                                <tr bgcolor="#FBFCE2">
                                    <td width="5%" align="center" rowspan="2">
                                        序号
                                    </td>
                                    <td width="5%" align="center" rowspan="2">
                                        姓名
                                    </td>
                                    <td width="15%" align="center" colspan="3">
                                        市内交通费
                                    </td>
                                    <td width="15%" align="center" colspan="3">
                                        在途费用<br />
                                        (不含机票)
                                    </td>
                                    <td width="8%" align="center" colspan="3">
                                        公务杂费
                                    </td>
                                    <td width="15%" align="center" colspan="3">
                                        住宿费
                                    </td>
                                    <td width="8%" align="center" colspan="3">
                                        汽油费
                                    </td>
                                    <td width="5%" align="center" rowspan="2">
                                        发票数
                                    </td>
                                    <td width="5%" align="center" rowspan="2">
                                        小计
                                    </td>
                                    <td width="5%" align="center" rowspan="2">
                                        出差伙<br />
                                        食补助
                                    </td>
                                    <td width="5%" align="center" rowspan="2">
                                        合计
                                    </td>
                                    <td width="5%" align="center" rowspan="2">
                                        报销单号
                                    </td>
                                    <td width="10%" align="center" rowspan="2">
                                        项目编号
                                    </td>
                                </tr>
                                <tr bgcolor="#FBFCE2">
                                    <td>
                                        金额
                                    </td>
                                    <td>
                                        发票数
                                    </td>
                                    <td>
                                        小计
                                    </td>
                                    <td>
                                        金额
                                    </td>
                                    <td>
                                        发票数
                                    </td>
                                    <td>
                                        小计
                                    </td>
                                    <td>
                                        金额
                                    </td>
                                    <td>
                                        发票数
                                    </td>
                                    <td>
                                        小计
                                    </td>
                                    <td>
                                        金额
                                    </td>
                                    <td>
                                        发票数
                                    </td>
                                    <td>
                                        小计
                                    </td>
                                    <td>
                                        金额
                                    </td>
                                    <td>
                                        发票数
                                    </td>
                                    <td>
                                        小计
                                    </td>
                                </tr>
                            </thead>
                            <tbody>
                                @{
                                    <tr bgcolor="#FFFFFF" align="center">
                                        <td>
                                            1
                                        </td>
                                        <td>@user.RealName
                                        </td>
                                        <td>@taxiMoney
                                        </td>
                                        <td>@taxiInvoice
                                        </td>
                                        <td>@taxiMoney
                                        </td>
                                        <td>@longMonty
                                        </td>
                                        <td>@longInvoice
                                        </td>
                                        <td>@longMonty
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>@hotelMonty
                                        </td>
                                        <td>@hotelInvoice
                                        </td>
                                        <td>@hotelMonty
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>@totalInvoice
                                        </td>
                                        <td>@totalMoney
                                        </td>
                                        <td>
                                            @allowanceMoney
                                        </td>
                                        <td>@lastMoney
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                        <td>@project.ProjectCode
                                        </td>
                                    </tr>
                                }
                            </tbody>
                        </table>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
